<template>
  <div class="keyvfor">
    <div v-for="(item, index) in list" :key="index">
      {{ item }}
    </div>
    <div @click="ondelete">
刪除
    </div>
  </div>
</template>

<script>
export default {
  name: "keyvfor",
  data() {
    return {
      list: [1, 2, 3]
    };
  },
  methods: {
    ondelete(){
      this.list.splice(1, 1);
      console.log(this.list);
    }
  }
};
</script>

<style scoped></style>
